package com.xxx.mall.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xxx.mall.model.AttrCategory;
import com.xxx.mall.vo.CategoryVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 属性与分类关联信息 Mapper 接口
 * </p>
 *
 * @author 邢晨旭
 * @since 2023-11-23
 */
public interface AttrCategoryMapper extends BaseMapper<AttrCategory> {

    /**
     * 根据属性id查询分类id
     *
     * @param attrId
     * @return
     */
    List<Long> getCategoryIdsByAttrId(Long attrId);

    /**
     * 批量插入
     *
     * @param attrId
     * @param addIds
     */
    void insertBatch(@Param("attrId") Long attrId, @Param("categoryIds") List<Long> addIds);

    void deleteBatch(@Param("attrId") Long attrId, @Param("categoryIds") List<Long> dbIds);

    /**
     *  根据属性id查询分类
     * @param id
     * @return
     */
    List<CategoryVO> ListByAttrId(Long id);
}
